#include <stdio.h>
char isleap(int y){return (y%4==0&&y%100!=0)||y%400==0;}
int ddd[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
    int y=0,m=0,d=0,ans=0;
    scanf("%d/%d/%d",&y,&m,&d);
    for(int i=1;i<m;++i)ans+=ddd[i],ans+=(i==2&&isleap(y));
    ans+=d;
    printf("%d",ans);
}